<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      /* 宽高为一个精灵图的尺寸 */
      width: 85px;
      height: 155px;
      background-image: url(./images/running2.jpg);
      /* 9就是精灵小图的个数 */
      animation:
       move 1s steps(9) infinite,
       run 1s forwards;
    }

    @keyframes move {
      /* from {
        background-position: 0 0;
      } */
      to {
        /* 1027为整个精灵图的宽度 */
        background-position: -1027px 0;
      }
    }
    
    @keyframes run {
      /* 动画的开始状态和盒子的默认样式相同时，可以省略开始状态的代码 */
      /* from {
        transform: translateX(0);
      } */
      to {
        transform: translateX(800px);
      }
    }
  </style>
</head>
<body>
  <div class="box"></div>
</body>
</html>